package com.dhcc.DRGsHosp.facade.impl.assembler;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

import com.dhcc.DRGsHosp.core.domain.MrqScore;
import com.dhcc.DRGsHosp.facade.dto.MrqScoreDTO;

public class MrqScoreAssembler {
	
	public static MrqScoreDTO toDTO(MrqScore mrqScore){
		if( mrqScore == null ){
			return null;
		}
		MrqScoreDTO mrqScoreDTO = new MrqScoreDTO();
		//没有setId
		mrqScoreDTO.setCheckDate(mrqScore.getCheckDate());
		mrqScoreDTO.setCompleteFlag(mrqScore.getCompleteFlag());
		mrqScoreDTO.setDepCode(mrqScore.getDepCode());
		mrqScoreDTO.setOrgCode(mrqScore.getOrgCode());
		mrqScoreDTO.setOutDate(mrqScore.getOutDate());
		mrqScoreDTO.setPmainIndex(mrqScore.getPmainIndex());
		mrqScoreDTO.setRatingLevel(mrqScore.getRatingLevel());
		mrqScoreDTO.setTotalScore(mrqScore.getTotalScore());
		
		return mrqScoreDTO;
	}
	
	public static List<MrqScoreDTO>  toDTOs(Collection<MrqScore>  mrqScoreMore){
		if ( mrqScoreMore == null) {
			return null;
		}
		List<MrqScoreDTO> mdrdList = new ArrayList<MrqScoreDTO>();
		for (MrqScore mrqScore : mrqScoreMore) {
			mdrdList.add( toDTO(mrqScore) );
		}
		return mdrdList;		
	}
	
	public static MrqScore toEntity(MrqScoreDTO mrqScoreDTO){
		if( mrqScoreDTO == null ){
			return null;
		}
		MrqScore mrqScore = new MrqScore();
		//没有setId
		mrqScore.setCheckDate(mrqScoreDTO.getCheckDate());
		mrqScore.setCompleteFlag(mrqScoreDTO.getCompleteFlag());
		mrqScore.setDepCode(mrqScoreDTO.getDepCode());
		mrqScore.setOrgCode(mrqScoreDTO.getOrgCode());
		mrqScore.setOutDate(mrqScoreDTO.getOutDate());
		mrqScore.setPmainIndex(mrqScoreDTO.getPmainIndex());
		mrqScore.setRatingLevel(mrqScoreDTO.getRatingLevel());
		mrqScore.setTotalScore(mrqScoreDTO.getTotalScore());
		
		return mrqScore;
	}
	
	public static List<MrqScore>  toEntities(Collection<MrqScoreDTO>  mrqScoreDTOMore){
		if ( mrqScoreDTOMore == null) {
			return null;
		}
		List<MrqScore> mdrList = new ArrayList<MrqScore>();
		for (MrqScoreDTO mrqScoreDTO : mrqScoreDTOMore) {
			mdrList.add( toEntity(mrqScoreDTO) );
		}
		return mdrList;		
	}
	
}
